 
  $(function(){
  			$.extend($.validator.messages, {
			specialCharValidate : "请不要输入特殊字符"
		});
	$.extend($.validator.classRuleSettings, {
		specialCharValidate:{specialCharValidate:true}
		});
	$.validator.addMethod("specialCharValidate", function(value, element) {
		var pattern = new RegExp("[`~!@%#$^&*()=|{}':;',　\\[\\]<>/? \\.；：%……+￥（）【】‘”“'。，、？]");
		return this.optional(element)||!pattern.test(value) ;
		}, $.format($.validator.messages["specialCharValidate"]));  
});
//form自动加载数据			
loadData = function(data){
	for(var attr in data){
		if(typeof(data[attr])=='function'){
			continue;
		}
		var $input = $(":input[id='"+attr+"']");
		var type = $input.attr("type");
		if(type=="checkbox" ||type=="radio"){
			var avalues = data[attr].split(",");
			for(var v=0; v<avalues.length;v++){
				$input.each(function(i,n){
					var value = $(n).val();                        
	            	if(value == avalues[v]){                        
	            	$(n).attr("checked","checked");
	            	}
				});
			}
	  }else{
		  $input.val(data[attr]);
	  }
	}
}
//liger from selected 自动加载数据
loadDataSelect = function(id,value,textValue){
	 $("#"+id+"_txt").val(textValue);
	 $("#"+id).val(value);
}
//liger from checkBox 自动填入表单
loadDataCheckBox = function(name,values){
	$(":input[name='"+name+"']").each(function(i,n){
		var v = $(n).val();
		if(values.indexOf(v)!=-1){
			$(n).prev("a").attr("class","l-checkbox l-checkbox-checked");
			$(n).attr("checked","checked");
		}
	});
}

function tip(message)
{
    $.ligerDialog.tip({ title: '提示信息', content: message.toString() });
}
    
/**隐藏冒泡提示*/
ligerHideTip = function() {

	$(".error").each(function() {

		$(this).ligerHideTip();

	});
}
/** 表单清空 */
fromClear = function(from) {
	$("#" + from).find(':input').each(function() {
		switch (this.type) {
		case 'passsword':
		case 'select-multiple':
		case 'select-one':
		case 'text':
		case 'hidden':
		case 'textarea':
			$(this).val('');
			break;
		case 'checkbox':
			$(this).prev("a").attr("class","l-checkbox");
		case 'radio':
			this.checked = false;
		}
	});
}